package com.young.sso.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * User实体类
 * Table创建数据表的注解
 * Entity ORM对象关系映射的关键注解
 * ToString排除指定字段，简化输出结果
 *
 * @author young
 * @date 2021/11/29 11:20
 */
@Data
@ToString(exclude = {"pwd", "token", "invitationCode"})
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "tb_user")
@Entity
public class User implements Serializable {
    /**
     * 用户编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    @ApiModelProperty(name = "id", value = "用户编号", dataType = "Long", example = "1")
    private Long id;

    /**
     * 用户名
     */
    @Column(name = "user_name")
    @ApiModelProperty(name = "name", value = "用户名", dataType = "Long", example = "chenj")
    private String name;

    /**
     * 用户头像
     */
    @Column(name = "user_icon")
    @ApiModelProperty(name = "icon", value = "用户头像", dataType = "String", example = "***.jpg")
    private String icon;

    /**
     * 用户昵称
     */
    @Column(name = "user_nickname")
    @ApiModelProperty(name = "nickName", value = "用户昵称", dataType = "String", example = "chenbupa")
    private String nickName;

    /**
     * 用户手机号
     */
    @Column(name = "user_phone")
    @ApiModelProperty(name = "phone", value = "用户手机号", dataType = "String", example = "159****5221")
    private String phone;

    /**
     * 用户密码
     */
    @Column(name = "user_pwd")
    @ApiModelProperty(name = "pwd", value = "用户密码", dataType = "String", example = "123456")
    private String pwd;

    /**
     * 真实姓名
     */
    @Column(name = "user_real_name")
    @ApiModelProperty(name = "realName", value = "真实姓名", dataType = "String", example = "陈劲")
    private String realName;

    /**
     * 用户身份证
     */
    @Column(name = "user_identity_card")
    @ApiModelProperty(name = "idCard", value = "用户身份证", dataType = "String", example = "362523************5")
    private String idCard;

    /**
     * 用户安全手机
     */
    @Column(name = "user_safety_phone")
    @ApiModelProperty(name = "safePhone", value = "用户安全手机", dataType = "String", example = "159****5221")
    private String safePhone;

    /**
     * 用户余额
     */
    @Column(name = "user_balance")
    @ApiModelProperty(name = "balance", value = "用户余额", dataType = "BigDecimal", example = "0")
    private BigDecimal balance;

    /**
     * 用户注册时间
     */
    @Column(name = "user_reg_time")
    @ApiModelProperty(name = "regTime", value = "用户注册时间", dataType = "Date", example = "2022-01-04 10:10:04")
    @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date regTime;
    /**
     * 用户注册时间
     */
    @Column(name = "token")
    private String token;

    /**
     * 用户最后登录时间
     */
    @Column(name = "user_last_time")
    @ApiModelProperty(name = "lastTime", value = "用户最后登录时间", dataType = "Date", example = "2022-01-06 10:10:07")
    @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastTime;

    /**
     * 用户邀请码
     */
    @Column(name = "user_invitation_code")
    @ApiModelProperty(name = "invitationCode", value = "用户邀请码", dataType = "String", example = "624578")
    private String invitationCode;

    /**
     * 好友使用该用户的邀请码注册的数量
     */
    @Column(name = "invite_friend_num")
    @ApiModelProperty(name = "inviteNum", value = "好友使用该用户的邀请码注册的数量", dataType = "Integer", example = "0")
    private Integer inviteNum;

    /**
     * 领取好友使用邀请码注册的任务金币的次数
     */
    @Column(name = "user_invite_num")
    @ApiModelProperty(name = "useInviteNum", value = "领取好友使用邀请码注册的任务金币的次数", dataType = "Integer", example = "0")
    private Integer useInviteNum;

    /**
     * 是否可领取首次设置安全手机号的任务的金币奖励
     */
    @Column(name = "has_get_first_safety")
    @ApiModelProperty(name = "hasGetFirstSafety", value = "是否可领取首次设置安全手机号的任务的金币奖励", dataType = "Boolean", example = "true")
    private Boolean hasGetFirstSafety;


}
